package org.easley.pay.controller;

import org.easley.pay.WeiboPayResult;
import org.easley.pay.WeiboPayViewUtil;
import org.easley.pay.common.ApiResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HanhanController {

    @GetMapping("/addUser")
    public ApiResult<String> addUser(@RequestParam("username") String username, @RequestParam("password") String password) {
        return WeiboPayViewUtil.addUser(username, password);
    }

    @GetMapping("/delUser")
    public void delUser(@RequestParam("username") String username) {
        WeiboPayViewUtil.delUser(username);
    }

    @GetMapping("/viewAll")
    public List<WeiboPayResult> viewAll(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
        return WeiboPayViewUtil.queryAll(startTime, endTime);
    }

}
